package com.yulongtian.interviewWorks.day20220826;

/**
 * https://leetcode.cn/problems/three-steps-problem-lcci/
 * @author YulongTian
 * @date 2022/8/26 - 14:27
 */
public class Test05 {
    public static void main(String[] args) {

    }

    public int waysToStep(int n) {
        int[] arr=new int[]{1,2,4};
        if(n<=3){
            return arr[n-1];
        }

        Long a=1l;
        Long b=2l;
        Long c=4l;

        for(int i=3;i<n;i++){
            Long temp=(a+b+c)%1000000007;
            a=b;
            b=c;
            c=temp;
        }

        return (int)(c%1000000007);
    }


}
